/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.anachronos.jeep.model.trace.impl;

import org.anachronos.jeep.model.trace.CallStacksType;
import org.anachronos.jeep.model.trace.DocumentRoot;
import org.anachronos.jeep.model.trace.MergedMethodInvocationsType;
import org.anachronos.jeep.model.trace.MergedSqlStatementExecutionsType;
import org.anachronos.jeep.model.trace.Method;
import org.anachronos.jeep.model.trace.MethodInvocation;
import org.anachronos.jeep.model.trace.MethodsType;
import org.anachronos.jeep.model.trace.Metrics;
import org.anachronos.jeep.model.trace.SqlStatementExecution;
import org.anachronos.jeep.model.trace.ThreadCallStack;
import org.anachronos.jeep.model.trace.Trace;
import org.anachronos.jeep.model.trace.TraceFactory;
import org.anachronos.jeep.model.trace.TracePackage;
import org.anachronos.jeep.model.trace.Transaction;
import org.anachronos.jeep.model.trace.TransactionStatus;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class TraceFactoryImpl extends EFactoryImpl implements TraceFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static TraceFactory init() {
		try {
			TraceFactory theTraceFactory = (TraceFactory)EPackage.Registry.INSTANCE.getEFactory("http://jeep.anachronos.org/trace"); 
			if (theTraceFactory != null) {
				return theTraceFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new TraceFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TraceFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case TracePackage.CALL_STACKS_TYPE: return createCallStacksType();
			case TracePackage.CLASS: return createClass();
			case TracePackage.DOCUMENT_ROOT: return createDocumentRoot();
			case TracePackage.MERGED_METHOD_INVOCATIONS_TYPE: return createMergedMethodInvocationsType();
			case TracePackage.MERGED_SQL_STATEMENT_EXECUTIONS_TYPE: return createMergedSqlStatementExecutionsType();
			case TracePackage.METHOD: return createMethod();
			case TracePackage.METHOD_INVOCATION: return createMethodInvocation();
			case TracePackage.METHODS_TYPE: return createMethodsType();
			case TracePackage.METRICS: return createMetrics();
			case TracePackage.PACKAGE: return createPackage();
			case TracePackage.SQL_STATEMENT_EXECUTION: return createSqlStatementExecution();
			case TracePackage.THREAD_CALL_STACK: return createThreadCallStack();
			case TracePackage.TRACE: return createTrace();
			case TracePackage.TRANSACTION: return createTransaction();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case TracePackage.TRANSACTION_STATUS:
				return createTransactionStatusFromString(eDataType, initialValue);
			case TracePackage.TRANSACTION_STATUS_OBJECT:
				return createTransactionStatusObjectFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case TracePackage.TRANSACTION_STATUS:
				return convertTransactionStatusToString(eDataType, instanceValue);
			case TracePackage.TRANSACTION_STATUS_OBJECT:
				return convertTransactionStatusObjectToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CallStacksType createCallStacksType() {
		CallStacksTypeImpl callStacksType = new CallStacksTypeImpl();
		return callStacksType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public org.anachronos.jeep.model.trace.Class createClass() {
		ClassImpl class_ = new ClassImpl();
		return class_;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DocumentRoot createDocumentRoot() {
		DocumentRootImpl documentRoot = new DocumentRootImpl();
		return documentRoot;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MergedMethodInvocationsType createMergedMethodInvocationsType() {
		MergedMethodInvocationsTypeImpl mergedMethodInvocationsType = new MergedMethodInvocationsTypeImpl();
		return mergedMethodInvocationsType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MergedSqlStatementExecutionsType createMergedSqlStatementExecutionsType() {
		MergedSqlStatementExecutionsTypeImpl mergedSqlStatementExecutionsType = new MergedSqlStatementExecutionsTypeImpl();
		return mergedSqlStatementExecutionsType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Method createMethod() {
		MethodImpl method = new MethodImpl();
		return method;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MethodInvocation createMethodInvocation() {
		MethodInvocationImpl methodInvocation = new MethodInvocationImpl();
		return methodInvocation;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MethodsType createMethodsType() {
		MethodsTypeImpl methodsType = new MethodsTypeImpl();
		return methodsType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Metrics createMetrics() {
		MetricsImpl metrics = new MetricsImpl();
		return metrics;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public org.anachronos.jeep.model.trace.Package createPackage() {
		PackageImpl package_ = new PackageImpl();
		return package_;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SqlStatementExecution createSqlStatementExecution() {
		SqlStatementExecutionImpl sqlStatementExecution = new SqlStatementExecutionImpl();
		return sqlStatementExecution;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ThreadCallStack createThreadCallStack() {
		ThreadCallStackImpl threadCallStack = new ThreadCallStackImpl();
		return threadCallStack;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Trace createTrace() {
		TraceImpl trace = new TraceImpl();
		return trace;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Transaction createTransaction() {
		TransactionImpl transaction = new TransactionImpl();
		return transaction;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TransactionStatus createTransactionStatusFromString(EDataType eDataType, String initialValue) {
		TransactionStatus result = TransactionStatus.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertTransactionStatusToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TransactionStatus createTransactionStatusObjectFromString(EDataType eDataType, String initialValue) {
		return createTransactionStatusFromString(TracePackage.Literals.TRANSACTION_STATUS, initialValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertTransactionStatusObjectToString(EDataType eDataType, Object instanceValue) {
		return convertTransactionStatusToString(TracePackage.Literals.TRANSACTION_STATUS, instanceValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TracePackage getTracePackage() {
		return (TracePackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static TracePackage getPackage() {
		return TracePackage.eINSTANCE;
	}

} //TraceFactoryImpl
